import { request } from "@/utils/request";
let userinfo = JSON.parse(sessionStorage.getItem('userInfo'))
let userId = ''
let organizationId = 0;
if (userinfo) {
    organizationId = userinfo.tenantId
    userId = userinfo.loginName
}
export const api = {
  getRisks: "/project/Windchill/servlet/rest/hzero/pmgt/risk/getRisks",
  getPageSelectPrincipal:"/workflow/Windchill/servlet/rest/hzero/foundation/workflow/getPageSelectPrincipal", 
  getPanleForPipmgt:"/project/Windchill/servlet/rest/hzero/pdm/attribute/getPanleForPipmgt",
  deleteObjForAllVersion:"/project/Windchill/servlet/rest/hzero/pdm/core/deleteObjForAllVersion",
  save:'/project/Windchill/servlet/rest/hzero/pmgt/risk/save',
  exportList:'/project/Windchill/servlet/rest/hzero/pmgt/project/exportTableData'
};
// http://pdmlink.sany.com.cn:80/Windchill/servlet/rest/hzero/pdm/core/noticeUser
// 获取项目风险列表
export function getRisks(parameter) {
  return request({
    url: api.getRisks,
    method: 'post',
    data: parameter
  })
}
// 获取流程处理人
export function getPageSelectPrincipal(parameter) {
  return request({
    url: api.getPageSelectPrincipal,
    method: 'post',
    data: parameter
  })
}
// 获取创建项目风险布局
export function getPanleForPipmgt(parameter) {
  return request({
    url: api.getPanleForPipmgt,
    method: 'post',
    data: parameter
  })
}
// 删除风险
export function deleteObjForAllVersion(parameter) {
  return request({
    url: api.deleteObjForAllVersion,
    method: 'post',
    data: parameter,
  })
}
// 提交保存风险
export function save(parameter) {
  return request({
    url: api.save,
    method: 'post',
    data: parameter,
  })
}
// 导出风险列表
export function exportList(parameter) {
  return request({
    url: api.exportList,
    method: 'post',
    data: parameter,
    responseType: 'blob' //服务器返回的数据类型
  })
}
// 获取交付物名称
export function getDisplayIdentifier(parameter) {
  return request({
    url: '/project/Windchill/servlet/rest/hzero/pdm/core/getDisplayIdentifier',
    method: 'post',
    data: parameter,
  })
}
// 获取交付物流程节点（流程指引）
export function getProcessSteps(parameter) {
  return request({
    url: '/workflow/Windchill/servlet/rest/hzero/foundation/workflow/getProcessSteps',
    method: 'post',
    data: parameter,
  })
}
// 获取交付物流程处理表格数据
export function getDisposeStatus(parameter) {
  return request({
    url: '/workflow/Windchill/servlet/rest/hzero/foundation/workflow/getDisposeStatus',
    method: 'post',
    data: parameter,
  })
}
// 获取风险类别
export function getRiskType(parameter) {
  return request({
    url: '/project/Windchill/servlet/rest/hzero/pmgt/risk/getRiskType',
    method: 'post',
    data: parameter,
  })
}
//获取计划活动内容
export function getActivity(parameter) {
  return request({
    url: '/deliver/Windchill/servlet/rest/hzero/pmgt/plan/getActivityTree',
    method: 'post',
    data: parameter,
  })
}
// 获取流程操作
export function getRouting(parameter) {
  return request({
    url: '/workflow/Windchill/servlet/rest/hzero/foundation/workflow/getRouting',
    method: 'post',
    data: parameter,
  })
}
// 获取已选的流程审批人
export function getWFSelectPrincipal(parameter) {
  return request({
    url: '/workflow/Windchill/servlet/rest/hzero/foundation/workflow/getWFSelectPrincipal',
    method: 'post',
    data: parameter,
  })
}
//  更新问题选择人
export function updateTeamPrincipal(parameter) {
  return request({
    url: '/workflow/Windchill/servlet/rest/hzero/pmgt/workflow/updateTeamPrincipal',
    method: 'post',
    data: parameter,
  })
}
// 起草人身份操作
export function creatorMake(parameter) {
  return request({
    url: '/workflow/Windchill/servlet/rest/hzero/foundation/workflow/completeRunningWorkItemBySelf',
    method: "post",
    data: parameter,
  });
}
//  问题确认上传附件带解决方案
export function addObjectAccessoryFile(parameter) {
  return request({
    url: '/project/Windchill/servlet/rest/hzero/pmgt/issues/addObjectAccessoryFile',
    method: 'post',
    data: parameter,
  })
}